﻿using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using mtg_trader.Database;
using mtg_trader.Database.DbSets;

namespace mtg_trader.Core.Search
{
    public static class MagicCards
    {
        public static IEnumerable<string> QuickCardList(string cardName)
        {
            using (var context = new MtgContext())
            {
                var cards = context.Cards;

                var topCards =
                    cards.Select(c => c.Name).Distinct().Where(n => n.Contains(cardName)).Take(5).ToList();

                return topCards;
            }
        }
    }
}